<template>
  <view class="map-container">
    <map 
      id="myMap" 
      style="width: 100%; height: 500px;" 
      :latitude="latitude" 
      :longitude="longitude" 
      scale="15" 
      :markers="markers" 
      :polyline="polyline"
    ></map>
  </view>
</template>

<script>
export default {
  data() {
    return {
      latitude: 34.257631, // 纬度
      longitude: 108.92835, // 经度
      markers: [
        {
          id: 0, // 确保id是数字类型
          latitude: 34.257631,
          longitude: 108.92835,
          width: 32,
          height: 42
        },
        {
          id: 1, // 确保id是数字类型
          latitude: 34.263238,
          longitude: 108.954831,
          width: 32,
          height: 42
        }
      ],
      polyline: {
        points: [
          {
            latitude: 34.257631,
            longitude: 108.92835
          },
          {
            latitude: 34.263238,
            longitude: 108.954831
          }
        ],
        color: '#FF0000',
        width: 3,
        dotted: false,
        arrows: 'true'
      }
    };
  }
};
</script>

<style>
.map-container {
  width: 100%;
  height: 100%;
}
</style>